package org.elasticsearch.springboot.service;

import org.elasticsearch.springboot.entity.TestBean;
import org.elasticsearch.springboot.repository.TestBeanRespository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestServiceImpl implements TestService {
    @Autowired
    TestBeanRespository testBeanRespository;

    @Override
    public Iterable<TestBean> findAll() {
        return testBeanRespository.findAll();
    }

    @Override
    public void save(List<TestBean> list) {
        testBeanRespository.saveAll(list);
    }

    @Override
    public void save(TestBean bean) {
        testBeanRespository.save(bean);
    }

    @Override
    public List<TestBean> findByName(String text) {
        return testBeanRespository.findByName(text);
    }

    @Override
    public List<TestBean> findByNameOrDesc(String text) {
        return testBeanRespository.findByNameOrDesc(text);
    }
}

